package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 张波
 * @Time: 2025/8/25 18:58
 */
@Controller
public class MyController {
	/// SpringMVC使用RESTFul风格完成请求url占位符的获取
	@RequestMapping(path = "url1/{data}")
	@ResponseBody
	public void url1(@PathVariable String data){
		System.out.println(data);
	}
	@RequestMapping("url2/{data}")
	@ResponseBody
	public void url2(@PathVariable(value = "data") String msg){
		System.out.println(msg);
	}
	@RequestMapping("url3/{data}/url3")
	@ResponseBody
	public void url3(@PathVariable("data") String msg){
		System.out.println(msg);
	}
	@RequestMapping("url4/{a}/{b}/{c}/{d}")
	@ResponseBody
	public void url4(@PathVariable String a,@PathVariable String b,@PathVariable String c,@PathVariable String d){
		System.out.println(a+b+c+d);
	}
}
